function [err,time]=chapter2_3run(t_max,n)
    err=zeros(3,1);
    time=zeros(3,1);
    function [u]=f(x,y,t)
        u=cos(pi*x)*cos(2*pi*y)*exp(-5*pi^2*t);
    end
    t0 = cputime;
    u=ADI2D(t_max,n);
    time(1)=cputime-t0;
    
    [s,t,l]=size(u);
    r = zeros(s,t,l);
    e = zeros(s,t,l);
    S = s-1;
    T = t-1;

    
    for k =1:l
        for i=1:s
            for j=1:t
                r(i,j,k) = f((i-1)/S,(j-1)/T,(k-1)*t_max/l);
                e(i,j,k) = abs(r(i,j,k)-u(i,j,k));
            end
        end
    end
    err(1) = max(max(max(e)));
    
    step = max(1,floor(l/100));
    for i =1:step:l
        meshc(u(:,:,i));
        %axis([1 s 1 t -1 1])
        
        pause on;
        pause(0.1);
    end
    %'press anykey to continue'
    %pause
    t0 = cputime;
    u=ForWard2D(t_max,n);
    time(2)= cputime - t0;
    [s,t,l]=size(u);
    r = zeros(s,t,l);
    e = zeros(s,t,l);
    S = s-1;
    T = t-1;
    for k =1:l
        for i=1:s
            for j=1:t
                r(i,j,k) = f((i-1)/S,(j-1)/T,(k-1)*t_max/l);
                e(i,j,k) = abs(r(i,j,k)-u(i,j,k));
            end
        end
    end
    err(2) = max(max(max(e)));
    step = max(1,floor(l/100));
    for i =1:step:l
        meshc(u(:,:,i));
        axis([1 s 1 t -1 1])
        pause on;
        %pause(0.1);
    end
    %'press anykey to continue'
    %pause
    t0 = cputime;
    u=Implicit2D(t_max,n);
    time(3)=cputime-t0;
    [s,t,l]=size(u);
        r = zeros(s,t,l);
    e = zeros(s,t,l);
    S = s-1;
    T = t-1;
    for k =1:l
        for i=1:s
            for j=1:t
                r(i,j,k) = f((i-1)/S,(j-1)/T,(k-1)*t_max/l);
                e(i,j,k) = abs(r(i,j,k)-u(i,j,k));
            end
        end
    end
    err(3) = max(max(max(e)));
    step = max(1,floor(l/100));
    for i =1:step:l
        meshc(u(:,:,i));
        axis([1 s 1 t -1 1])
       
        pause on;
        %pause(0.1);
    end
    
end